package com.coderman.basketball.infrast.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component
@Aspect
@Slf4j
public class IdemPotentAdvisor {

    @Pointcut("@annotation(com.coderman.basketball.infrast.aop.IdemPotent)")
    public void idemPotentiPointCut() {

    }

    @Transactional(rollbackFor = Exception.class)
    @Around("@annotation(idemPotent)")
    public Object aroundIdemPotent(ProceedingJoinPoint joinPoint, IdemPotent idemPotent) throws Throwable {
        return joinPoint.proceed();
    }

}
